<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="database.*" %>
<%@ page import="java.util.List" %>
<%@page import="servlet.ArticleType"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>赛事活动-清风品道</title>
<script type="text/javascript" language="JavaScript">
	function setStyle() {
		document.getElementById("navMatch").style.color="#CC0000";
		document.getElementById("navMatch").style.background="url(./image/nav.jpg) no-repeat 0px -20px";
	}
</script>
</head>
<body onload="setStyle()">
	<%@ include file="./nav.jsp" %>
<%
request.setCharacterEncoding("utf-8");
final int belongTo = ArticleType.MATCH.getBelongTo();
List<Article> list = DatabaseManager.articleQueryByBelongTo(belongTo);
%>
<br />

<div style="min-height:380px">
<table width="500px" align="center">
	<%
		String permission = (String)session.getAttribute("permission");
		if(permission != null && permission.equals("a")) {
	%>
	<tr>
		<td align="left" colspan="2">
			<a href="<%=request.getContextPath() + "/newMatch.jsp"  %>" style="float:right" target="_blank">发表新文章</a>
		</td>
	</tr>
	<%	
		}
		java.text.SimpleDateFormat formatter1 = new java.text.SimpleDateFormat("yyyyMMddHHmmssSS");
		java.text.SimpleDateFormat formatter2 = new java.text.SimpleDateFormat("yyyy-MM-dd");
		for(Article article : list) {
	%>
	<tr>
		<td align="left">
			<div style="border-bottom-style:dashed; border-width:1px;">
				&nbsp;<a style="text-decoration:none" href="<%= request.getContextPath() + "/article.jsp?articleID=" + article.getArticleID() %>" target="_blank"><%= article.getTitle() %></a>
			</div>
		</td>
		<td width="90px" align="right">
			<div style="border-bottom-style:dashed; border-width:1px;">
				<%= formatter2.format(article.getPublishTime()) %>
			</div>
		</td>
	</tr>
	<%} %>
</table>
</div>
<jsp:include page="./bottom.jsp"></jsp:include>
</body>
</html>